//
//  AppDelegate.m
//  Powertech
//
//  Created by 魏延(颜魏) on 2024/12/9.
//

#import "AppDelegate.h"
#import "IQKeyboardManager.h"
#import "HomeViewController.h"
#import "BTManager.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    self.window = [[UIWindow alloc] init];
    self.window.frame = [UIScreen mainScreen].bounds;
    [self.window makeKeyAndVisible];
    HomeViewController *homeVC = [[HomeViewController alloc] initWithNibName:@"HomeViewController" bundle:nil];
    UINavigationController *nv = [[UINavigationController alloc] initWithRootViewController:homeVC];
    self.window.rootViewController = nv;

    [IQKeyboardManager sharedManager].enable = YES;
    [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
    [IQKeyboardManager sharedManager].enableAutoToolbar = YES;
    [[IQKeyboardManager sharedManager] setToolbarManageBehaviour:IQAutoToolbarByPosition];

    return YES;
}

- (void)applicationWillTerminate:(UIApplication *)application {
    [BTManager sharedBTManager].isGettingBattery = NO;
    [[BTManager sharedBTManager] disconnectRootPeripheral];
}

@end
